﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TTQT.TTQT_Code;

public partial class QuickHelp : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            try
            {
                string pageid="";

                if (null == Request.QueryString["pageId"].ToString())
                    pageid = "131";
                else
                {
                    if (Request.QueryString["pageId"].Equals("0"))
                    {
                        pageid = "131";
                    }
                    else
                    {
                        pageid = Request.QueryString["pageId"].ToString();
                    }
                }
                DataAccessObject.instance().FillToListBox(cboPage.Items);
                cboPage.SelectedValue = pageid;
                showHelp();
            }
            catch {}
        }
    }
    private void showHelp()
    {
        try
        {
            ds.SelectCommand = "Select noidung from QuickHelp where pageId=" + cboPage.SelectedValue;
            string noiDung = ((DataView)ds.Select(new DataSourceSelectArguments())).ToTable().Rows[0][0].ToString();
            lblNoiDung.Text = noiDung;
        }
        catch (Exception ex)
        {
            lblNoiDung.Text = "Chưa có QuickHelp cho chức năng này.";
        }
    }
    protected void cboPage_SelectedIndexChanged(object sender, EventArgs e)
    {
        showHelp();
    }
}
